﻿<s:ScatterViewItem 
  x:Class="SurfaceCardsGameKit.Games.BasicGame.HelpBook"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:s="http://schemas.microsoft.com/surface/2008"
  xmlns:WPFMitsuControlsv2="clr-namespace:WPFMitsuControlsv2;assembly=WPFMitsuControlsv2" 
  xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
  xmlns:local="clr-namespace:SurfaceCardsGameKit.Games.BasicGame"
  mc:Ignorable="d"
  Width="520"
  Height="400"
  CanRotate="True"
  CanScale="False"
  Center="500,500"
  Orientation="0"
  Foreground="Black"
  Background="Transparent"
>
  <s:ScatterViewItem.Style>
    <Style TargetType="{x:Type s:ScatterViewItem}">
      <Setter Property="Template" Value="{StaticResource scatterViewItemWithoutShadowTemplate}" />
    </Style>
  </s:ScatterViewItem.Style>
  <s:ScatterViewItem.Resources>

    <CollectionViewSource x:Key="PagesCVS" Source="{Binding RelativeSource={RelativeSource AncestorType=local:HelpBook}, Path=Pages}" />

    <DrawingBrush x:Key="Fermer" Stretch="Uniform">
      <DrawingBrush.Drawing>
        <DrawingGroup>
          <DrawingGroup.Children>
            <GeometryDrawing Geometry="F1 M 25.2304,0.0500488C 39.1372,0.0500488 50.4109,11.3237 50.4109,25.2305C 50.4109,39.1372 39.1372,50.4109 25.2304,50.4109C 11.3237,50.4109 0.0500183,39.1372 0.0500183,25.2305C 0.0500183,11.3237 11.3237,0.0500488 25.2304,0.0500488 Z ">
              <GeometryDrawing.Pen>
                <Pen Thickness="0.1" LineJoin="Round" Brush="#FF000000"/>
              </GeometryDrawing.Pen>
              <GeometryDrawing.Brush>
                <LinearGradientBrush StartPoint="0.556325,0.973379" EndPoint="0.447667,-0.00773471">
                  <LinearGradientBrush.GradientStops>
                    <GradientStop Color="#FF565656" Offset="0"/>
                    <GradientStop Color="#FFFFFFFF" Offset="1"/>
                  </LinearGradientBrush.GradientStops>
                </LinearGradientBrush>
              </GeometryDrawing.Brush>
            </GeometryDrawing>
            <GeometryDrawing Brush="#FFFFFFFF" Geometry="F1 M 11.6415,32.569L 19.6771,24.5334L 11.4355,16.2919C 10.582,15.4384 10.582,14.0547 11.4355,13.2013L 13.4959,11.1409C 14.3493,10.2874 15.733,10.2874 16.5865,11.1409L 24.828,19.3824L 33.0696,11.1408C 33.923,10.2874 35.3067,10.2874 36.1602,11.1408L 38.2206,13.2012C 39.074,14.0547 39.074,15.4384 38.2206,16.2918L 29.979,24.5334L 38.0146,32.569C 38.868,33.4224 38.868,34.8061 38.0146,35.6596L 35.9542,37.72C 35.1008,38.5734 33.717,38.5734 32.8636,37.72L 24.828,29.6844L 16.7925,37.7199C 15.939,38.5734 14.5553,38.5734 13.7019,37.7199L 11.6415,35.6595C 10.7881,34.8061 10.7881,33.4224 11.6415,32.569 Z ">
              <GeometryDrawing.Pen>
                <Pen Thickness="0.1" LineJoin="Round" Brush="#FF878787"/>
              </GeometryDrawing.Pen>
            </GeometryDrawing>
          </DrawingGroup.Children>
        </DrawingGroup>
      </DrawingBrush.Drawing>
    </DrawingBrush>

  </s:ScatterViewItem.Resources>

  <Grid>
    <Grid.ColumnDefinitions>
      <ColumnDefinition Width="*" />
      <ColumnDefinition Width="Auto" />
    </Grid.ColumnDefinitions>
    
    <Grid.RowDefinitions>
      <RowDefinition Height="Auto" />
      <RowDefinition Height="*" />
    </Grid.RowDefinitions>
    
    <WPFMitsuControlsv2:Book x:Name="book" Grid.Row="1" PageSize="245,327" HorizontalAlignment="Center" VerticalAlignment="Center" 
                               SelectionChanged="book_SelectionChanged">

      <WPFMitsuControlsv2:Book.BookmarkerStyle>
        <Style TargetType="{x:Type ContentControl}">
          <Setter Property="Visibility" Value="Collapsed" />
        </Style>
      </WPFMitsuControlsv2:Book.BookmarkerStyle>

      <WPFMitsuControlsv2:Book.Resources>

        <DataTemplate x:Key="FreeTemplate">
          <Border Background="White" BorderThickness="1" BorderBrush="Black">
            <Grid>
              <ContentControl Content="{Binding .}"/>
            </Grid>
          </Border>
        </DataTemplate>

        <DataTemplate x:Key="VideoLeftTemplate">
          <Border Background="Black" BorderThickness="1" BorderBrush="White">
            <Grid TextBlock.Foreground="White">
              <Grid.RowDefinitions>
                <RowDefinition Height="0.5*"/>
                <RowDefinition Height="0.5*"/>
              </Grid.RowDefinitions>
              <Path Stretch="Fill" Stroke="White" StrokeThickness="0.5" Margin="6.758,0,0,7.5" Data="M28.258,7 L6.7579994,7 6.7579994,314.5 28.256495,314.5" HorizontalAlignment="Left" Width="22.434" Grid.Row="1"/>
              <Path Stretch="Fill" Stroke="White" Margin="0,0.761,6.803,7.5" Data="M28.258,7 L6.7579994,7 6.7579994,314.5 28.256495,314.5" StrokeThickness="0.5" RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Right" Width="22.408" Grid.Row="1">
                <Path.RenderTransform>
                  <TransformGroup>
                    <ScaleTransform/>
                    <SkewTransform/>
                    <RotateTransform Angle="180"/>
                    <TranslateTransform/>
                  </TransformGroup>
                </Path.RenderTransform>
              </Path>
              <TextBlock Margin="37.596,0,37.596,3.5" VerticalAlignment="Bottom" Height="11.5" FontFamily="Aharoni" Text="Surface Academy 2009 Toolkit" TextWrapping="Wrap" TextAlignment="Center" FontSize="10.667" Grid.Row="1" />
              <Border BorderThickness="2" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.RowSpan="3" Grid.ColumnSpan="2" Width="193" 
                    Height="166">
                <ContentControl Content="{Binding MediaElement}" />
              </Border>
              <Rectangle Stroke="White" Margin="26,-62,26,0" StrokeThickness="2" VerticalAlignment="Top" Height="124.5" Grid.Row="1"/>
            </Grid>
          </Border>
        </DataTemplate>

        <DataTemplate x:Key="VideoRightTemplate">

          <Border Background="White" BorderThickness="1" BorderBrush="Black">
            <Grid>
              <Grid.RowDefinitions>
                <RowDefinition Height="0.009*"/>
                <RowDefinition Height="0.013*"/>
                <RowDefinition Height="0.052*"/>
                <RowDefinition Height="0.826*"/>
                <RowDefinition Height="0.1*"/>
              </Grid.RowDefinitions>
              <Grid.ColumnDefinitions>
                <ColumnDefinition Width="0.12*"/>
                <ColumnDefinition Width="0.036*"/>
                <ColumnDefinition Width="0.688*"/>
                <ColumnDefinition Width="0.036*"/>
                <ColumnDefinition Width="0.12*"/>
              </Grid.ColumnDefinitions>
              <TextBlock x:Name="titleTB" Grid.Column="2" Grid.Row="1" Grid.RowSpan="2" FontFamily="Aharoni" FontSize="17.333" 
                         Foreground="Black" Text="{Binding Title}" TextAlignment="Center" TextWrapping="Wrap"/>

              <ItemsControl ItemsSource="{Binding ActionResults}" Grid.Column="2" Grid.Row="3" 
                          TextBlock.FontFamily="Century Gothic" TextBlock.FontSize="14.667"
                          TextBlock.TextAlignment="Center" Foreground="Black">

                <ItemsControl.ItemTemplate>
                  <DataTemplate>
                    <StackPanel Margin="0,10,0,0">
                      <TextBlock FontWeight="Bold" Text="Action : "/>
                      <TextBlock Text="{Binding ActionLines}" TextWrapping="WrapWithOverflow" />
                      <TextBlock FontWeight="Bold" Text="Result : " Margin="0,10,0,0" />
                      <TextBlock Text="{Binding ResultLines}" TextWrapping="WrapWithOverflow" />
                    </StackPanel>
                  </DataTemplate>

                </ItemsControl.ItemTemplate>

              </ItemsControl>

              <Path Stretch="Fill" Stroke="Black" StrokeThickness="0.5" Margin="6.758,0,-0.272,7.5" Grid.RowSpan="3" 
                  Data="M28.258,7 L6.7579994,7 6.7579994,314.5 28.256495,314.5" Grid.Row="2"/>
              <Path Stretch="Fill" Stroke="Black" Margin="-0.05,0,6.803,7.5" Grid.RowSpan="3" 
                  Data="M28.258,7 L6.7579994,7 6.7579994,314.5 28.256495,314.5" StrokeThickness="0.5" RenderTransformOrigin="0.5,0.5" 
                  Grid.Column="4" Grid.Row="2">
                <Path.RenderTransform>
                  <TransformGroup>
                    <ScaleTransform/>
                    <SkewTransform/>
                    <RotateTransform Angle="180"/>
                    <TranslateTransform/>
                  </TransformGroup>
                </Path.RenderTransform>
              </Path>
              <TextBlock Margin="0,0,0,3.5" VerticalAlignment="Bottom" Height="11.5" Grid.Column="2" Grid.Row="4" FontFamily="Aharoni" 
                       Foreground="Black" Text="Surface Academy 2009 Toolkit" TextWrapping="Wrap" FontSize="10.667" TextAlignment="Center"/>
            </Grid>
          </Border>
        </DataTemplate>

        <Style TargetType="{x:Type WPFMitsuControlsv2:BookItem}">
          <Setter Property="Header" Value="{Binding BookmarkTitle}" />

          <Setter Property="MinWidth" Value="60" />

          <Style.Triggers>
            <DataTrigger Binding="{Binding BookmarkTitle}" Value="{x:Null}">
              <Setter Property="MinWidth" Value="0" />
              <Setter Property="Width" Value="0" />
            </DataTrigger>
          </Style.Triggers>

        </Style>

      </WPFMitsuControlsv2:Book.Resources>

      <WPFMitsuControlsv2:Book.ContentTemplateSelector>
        <local:HelpbookDataTemplateSelector
            FreeTemplate="{StaticResource FreeTemplate}" 
            PageLeftTemplate="{StaticResource VideoLeftTemplate}"
            PageRightTemplate="{StaticResource VideoRightTemplate}" />
      </WPFMitsuControlsv2:Book.ContentTemplateSelector>

      <WPFMitsuControlsv2:Book.ItemsSource>

        <CompositeCollection>

          <Grid x:Name="PagedeCouv" Background="White" d:IsHidden="True">
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="0.119*"/>
              <ColumnDefinition Width="0.761*"/>
              <ColumnDefinition Width="0.12*"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
              <RowDefinition Height="0.1*"/>
              <RowDefinition Height="0.5*"/>
              <RowDefinition Height="0.4*"/>
            </Grid.RowDefinitions>
            
            <Image Source="LogoSurfaceflipbook.jpg" Grid.Row="1" Grid.ColumnSpan="3" Stretch="Uniform" />
            <Label Content=" Surface&#xa;Academy&#xa;  Toolkit" FontFamily="Cooper Black" FontSize="18" Grid.Row="2" Foreground="#FF080372" Grid.Column="1" Height="93.326" VerticalAlignment="Center" d:LayoutOverrides="Width" HorizontalContentAlignment="Center" />
            <Path Stretch="Fill" Stroke="#FF080372" Margin="6.758,7,-0.518,7.5" Data="M28.258,7 L6.7579994,7 6.7579994,314.5 28.256495,314.5" Grid.RowSpan="3" StrokeThickness="0.5"/>
            <Path Stretch="Fill" Stroke="#FF080372" Margin="-0.372,7,6.803,7.5" Grid.RowSpan="3" Data="M28.258,7 L6.7579994,7 6.7579994,314.5 28.256495,314.5" Grid.Column="2" RenderTransformOrigin="0.5,0.5" StrokeThickness="0.5">
              <Path.RenderTransform>
                <TransformGroup>
                  <ScaleTransform/>
                  <SkewTransform/>
                  <RotateTransform Angle="180"/>
                  <TranslateTransform/>
                </TransformGroup>
              </Path.RenderTransform>
            </Path>
          </Grid>

          <Grid x:Name="Page1G" Background="White" />

          <Grid x:Name="Page2D" Background="White" d:IsHidden="True" >
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="0.12*"/>
              <ColumnDefinition Width="0.036*"/>
              <ColumnDefinition Width="0.688*"/>
              <ColumnDefinition Width="0.035*"/>
              <ColumnDefinition Width="0.121*"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
              <RowDefinition Height="0.009*"/>
              <RowDefinition Height="0.013*"/>
              <RowDefinition Height="0.052*"/>
              <RowDefinition Height="0.316*"/>
              <RowDefinition Height="0.31*"/>
              <RowDefinition Height="0.3*"/>
            </Grid.RowDefinitions>
            <TextBlock Grid.Column="2" FontFamily="Aharoni" FontSize="17.333" Foreground="#FF080372" Text="Project presentation" TextAlignment="Center" TextWrapping="Wrap" Grid.Row="1" Grid.RowSpan="2" Margin="0,0,0.482,0"/>
            <TextBlock Grid.Column="2" Grid.Row="4" FontSize="14.667" TextAlignment="Center" TextWrapping="Wrap" FontFamily="Century Gothic" Margin="0,0.173,0.482,0.15"><Run Text="This book will guide "/><LineBreak/><Run Text="you through the manipulation of cards decks and boards. "/></TextBlock>
            <Path Stretch="Fill" Stroke="#FF080372" StrokeThickness="0.5" Margin="6.758,0,-0.272,7.5" Grid.RowSpan="4" Data="M28.258,7 L6.7579994,7 6.7579994,314.5 28.256495,314.5" Grid.Row="2"/>
            <Path Stretch="Fill" Stroke="#FF080372" Margin="-0.05,0,6.803,7.5" Grid.RowSpan="4" Data="M28.258,7 L6.7579994,7 6.7579994,314.5 28.256495,314.5" StrokeThickness="0.5" RenderTransformOrigin="0.5,0.5" Grid.Column="4" Grid.Row="2">
              <Path.RenderTransform>
                <TransformGroup>
                  <ScaleTransform/>
                  <SkewTransform/>
                  <RotateTransform Angle="180"/>
                  <TranslateTransform/>
                </TransformGroup>
              </Path.RenderTransform>
            </Path>
            <TextBlock Margin="0,0,0,3.5" VerticalAlignment="Bottom" Height="11.5" Grid.Column="2" Grid.Row="5" Text="Surface Academy 2009 Toolkit" TextWrapping="Wrap" FontFamily="Aharoni" Foreground="#FF080372"/>
          </Grid>

          <CollectionContainer Collection="{Binding Source={StaticResource PagesCVS}}" />

        </CompositeCollection>

      </WPFMitsuControlsv2:Book.ItemsSource>


    </WPFMitsuControlsv2:Book>
    
    <s:SurfaceButton Width="30" Height="30" Grid.Column="1" 
                     Command="{Binding RelativeSource={RelativeSource AncestorType=local:HelpBook}, Path=CloseBookCommand}">
      <s:SurfaceButton.Template>
        <ControlTemplate TargetType="{x:Type s:SurfaceButton}">
          <Rectangle Fill="{StaticResource Fermer}" />
        </ControlTemplate>
      </s:SurfaceButton.Template>
    </s:SurfaceButton>
  </Grid>

</s:ScatterViewItem>
